const nodemailer = require('nodemailer');

async function testEmail() {
  const transporter = nodemailer.createTransport({
    host: 'smtp.163.com',
    port: 465,
    secure: true,
    auth: {
      user: 'web_lh18391735162@163.com',
      pass: 'BHyMkcPEFD9zRt4q' // 与login.js保持一致
    }
  });

  try {
    const info = await transporter.sendMail({
      from: '"测试" <web_lh18391735162@163.com>',
      to: 'web_lh18391735162@163.com', // 修改为你的163邮箱
      subject: '测试邮件',
      text: '这是一封来自nodemailer的测试邮件'
    });
    console.log('邮件发送成功:', info.messageId);
  } catch (error) {
    console.error('邮件发送失败:', error);
  }
}

testEmail();